import React,{Component} from 'react';
import ReactDOM from 'react-dom';
let { observable, observe, computed, autorun, when, action } = require("mobx");
import { observer} from "mobx-react"

class Store {
    @observable number=0;
    @action.bound add() {
        this.number++;
    }

}
let store = new Store();


@observer
class Counter extends Component {
    render() {
        return <div>
                <p>这是第一个{store.number}</p>
                <button onClick = {store.add} >点击一下</button>
        </div>
    }
}

@observer
class Counter2 extends Component {
    render() {
        return <div>
                <p> 这是第二个{store.number}</p>
        </div>
    }
}
ReactDOM.render(<div>
   <Counter2 />
   <Counter/>
</div>,
document.querySelector("#app"))